import React from 'react'
interface ClickType{
  (): void
}
interface PropType {
  name: string
  color?: string,
  size?: number,
  stop?: boolean,
  onClick?: ClickType
}
 function Icon(props:PropType) {
  return (
    <i 
      className={'iconfont icon-'+props.name}
      style={
        {
          color: props.color,
          fontSize: props.size
        }
      }
      onClick={
       (e) => {
        props.stop && e.stopPropagation();
        props.onClick();
       }
      }
    ></i>
  )
}
Icon.defaultProps = {
  color: '#333',
  size: 16,
  onClick: () => {

  },
  stop: false
}
export default Icon